Activity Diagram for the Elevator System
Create some activity diagrams for the elevator system problem.
An activity diagram is a great way to visualize the flow of messages from one activity to the other in the system. There can be different activity diagrams that we can create for our elevator system. In this lesson, we will create activity diagrams for the following two activities:
The passenger arrives at the desired floor.
Activity challenge: The passenger calls for the elevator.
The passenger arrives at the desired floor #
The following are the states and actions that will be involved in this activity diagram.
States#
Initial state: The passenger enters the elevator car.
Final state: There are two final states present in this activity diagram. These are shown below:
The passenger arrives at the destination floor.
The passenger is not allowed due to max load/capacity issues.
Actions#
The passenger enters the elevator car. The elevator car checks if the safety limits are met. The elevator car stops at other passengers’ floors. Finally, the elevator car reaches the passenger’s desired floor.
Based on the order above, the activity diagram of a passenger arriving at their desired floor is given below.
Note: Here, the passenger is just entering the elevator, so either the up or the down button can be pressed.
Activity challenge: The passenger calls for the elevator#
You will create an activity diagram of a passenger calling for the elevator.
A skeleton of the activity diagram is given below.
Notice that the actions in the diagram above are numbered from 1 to 10. The slots shown below represent the activities, and the arrows represent the flow from one activity to the other.
Can you rearrange the slots below in the correct order they should appear in the activity diagram above?
Note: If you get stuck, just click the “Show Solution” button to check the correct answer.
Alternatively, you can also click the "Show complete diagram" button below to see the complete sequence diagram.
We've looked at some of the activity diagrams of our elevator system. In the next lesson, we will present the code for our designed classes in some of the most popular languages.
Sequence Diagram for the Elevator System
Code of Elevator System